package atom.core3.hibernate;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.hibernate.Hibernate;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.StringType;

public class TypeConvert
{
	public static Map<String,org.hibernate.type.Type> typeMap = new HashMap();
	//静态初始化
	static  {
		typeMap.put(String.class.getName(), StandardBasicTypes.STRING);
		typeMap.put(Integer.class.getName(), StandardBasicTypes.INTEGER);
		typeMap.put(Long.class.getName(), StandardBasicTypes.LONG);
		typeMap.put(Double.class.getName(), StandardBasicTypes.DOUBLE);
		typeMap.put(Date.class.getName(), StandardBasicTypes.TIMESTAMP);
	}
	public static void registerType(String className,org.hibernate.type.Type myType)
	{
		typeMap.put(className, myType);
	}
	public static org.hibernate.type.Type convert(String className)
	{
		org.hibernate.type.Type myType = typeMap.get(className);
		return myType;
	}
	
}
